package com.kfc.platform.user.server.test;



import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import com.kfc.platform.util.DateFormat;
import com.kfc.platform.user.domain.User;
import com.kfc.platform.user.service.UserService;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/applicationContext.xml")
@Transactional
public class UserServiceTestCase {
	@Autowired
	private UserService userService;
	private User user = new User();
	@Test
	@Rollback(false)
	public void testCreateUser(){
		user.setDate( new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
		user.setUsername("asdfgg");
		user.setPassword("12412421");
		user.setEmail("330247353@qq.com");
		user.setPhonenum("13843073682");
		String str = userService.createUser(user);
		System.out.println("from test:"+str);
	}
	@Test
	@Rollback(false)
	public void testDeleteUser(){
		userService.deleteUser(user);
	}
	
	
}
